//
//  LLNWFileUploadManager+IMServer.m
//  LLFoundation
//
//  Created by my_liu on 2016/11/14.
//  Copyright © 2016年 . All rights reserved.
//

#import "LLNWFileUploadManager+IMServer.h"
#import "LLNWConstantManager.h"

@implementation LLNWFileUploadManager (IMServer)

+ (BOOL)checkDefaultHeadersValue
{
    LLNWConstantManager *constManager = [LLNWConstantManager share];
    
    if (!constManager.llnwagency || !constManager.llnwcustomId  || !constManager.llnwversionId  || !constManager.llnwserverDomain) {
        
        return NO;
    }
    return YES;
}

+ (LLNWFileUploadManager *)imServerUploadManager
{
    LLNWConstantManager *constManager = [LLNWConstantManager share];
    
    
    LLNWFileUploadManager *uploadManager = [[LLNWFileUploadManager alloc]init];
    
    /* 必须要有合法的requeshtHeader */
    if (![LLNWFileUploadManager checkDefaultHeadersValue]) {
        
        //        NSLog(@"CUCFUploadManager+IMServer 没有找到合法的默认requestHeader");
        
        return uploadManager;
    }
    
    /* 设定主机 */
    [uploadManager setDefaultHostUrl:constManager.llnwnewServerURL];
    
    //    /* 设定默认Header */
    NSMutableDictionary *defaultHeaders =  [NSMutableDictionary dictionaryWithDictionary:[constManager getDefaultHeader]];
    [uploadManager setDefaultRequestHeader:defaultHeaders];
    
    [uploadManager setDefaultUploadPath:@"UploadImages"];
    
    /* 没有默认参数 */
    [uploadManager setDefaultRequestParams:[NSMutableDictionary dictionary]];
    
    return uploadManager;
    
}

@end
